﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Test4();
        }
        //用户输入正方形边长，用*打印出实心正方形。
        static void Test1()
        {
            Console.WriteLine("请输入正方形的边长：");
            int a = int.Parse(Console.ReadLine());

            for (int i = 0; i < a; i++)
            {
                for (int j = 0; j < a; j++)
                {
                    Console.Write("* ");
                }
                Console.WriteLine();
            }
        }
        //打印九九乘法表
        static void Test2()
        {
            int[,] arr = new int[9,9];
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < i+1; j++)
                {
                    Console.Write((j + 1) + "*" + (i + 1) + "=" + (i + 1) * (j + 1) + "\t");
                }
                Console.WriteLine();
            }
        }
        static void Test3()
        {
            Console.WriteLine("请输入正方形的边长：");
            int a = int.Parse(Console.ReadLine());

            for (int i = 1; i <= a; i++)
            {
                for (int j = 1; j <= a; j++)
                {
                    if (j == 1 || j == a || i == 1 || i == a)
                    {
                        Console.Write(" *");
                    }
                    else
                    {
                        Console.Write("  ");
                    }
                }
                Console.WriteLine();
            }
        }
        //打印菱形
        static void Test4()
        {
           Console.WriteLine("请输入菱形的边长：");
            int a = int.Parse(Console.ReadLine());

            for (int i = 1; i <= a; i++)
            {
                for (int j = 1; j <= a - i; j++)
                {
                    Console.Write(" ");
                }
                for (int k = 1; k <= 2 * i - 1; k++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
            for (int i = 1; i <= a-1; i++)
            {
                for (int j = 1; j <= i; j++)
                {
                    Console.Write(" ");
                }
                for (int k = 2*a-3; k >= 2 * i - 1; k--)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
        }
    }
}
